#include <iostream>
#include <cstdio>

using namespace std;

const int MAXN = 2510;

typedef long long ll;

int a[MAXN][MAXN],n,m,k,cnt[2][12];
ll s[MAXN][MAXN],ans;

ll cal(int x1,int x2,int y1,int y2){
	return s[x2][y2] - s[x2][y1] - s[x1][y2] + s[x1][y1];
}

void divide(int x1,int x2,int y1,int y2,int tp){
//	cout << x1<<x2<<y1<<y2<<endl;
	if(x1 == x2 || y1 == y2) return ;
	if(x1 == x2 - 1 && y1 == y2 - 1) return (void)(ans += cal(x1,x2,y1,y2) == k);
	if(tp){
		int mid = x1 + x2 >> 1;
		divide(x1,mid,y1,y2,tp^1);
		divide(mid,x2,y1,y2,tp^1);
		for(int i = y1;i <= y2;i++){
			cnt[0][0] = cnt[1][0] = mid;
			for(int p = 1;p <= k+1;p++) {
				cnt[0][p] = x1;
				cnt[1][p] = x2;
			}
			for(int j = i + 1;j <= y2;j++){
				for(int p = 1;p <= k+1;p++){
					while(cal(cnt[0][p],mid,i,j) >= p)
						cnt[0][p]++;
					while(cal(mid,cnt[1][p],i,j) >= p)
						cnt[1][p]--;
				}
				for(int p = 0;p <= k;p++)
					ans += (ll)(cnt[0][p]-cnt[0][p+1]) * (cnt[1][k-p+1] - cnt[1][k-p]);
			}
		}
	}else{
		int mid = y1 + y2>>1;
		divide(x1,x2,y1,mid,tp^1);
		divide(x1,x2,mid,y2,tp^1);
		for(int i = x1;i <= x2;i++){
			cnt[0][0] = cnt[1][0] = mid;
			for(int p = 1;p <= k+1;p++){
				cnt[0][p] = y1;
				cnt[1][p] = y2;
			}
			for(int j = i+1;j <= x2;j++){
				for(int p = 1;p <= k+1;p++){
					while(cal(i,j,cnt[0][p],mid) >= p)
						cnt[0][p]++;
					while(cal(i,j,mid,cnt[1][p]) >= p)
						cnt[1][p]--;
				}
				for(int p = 0;p <= k;p++)
					ans += (ll)(cnt[0][p] - cnt[0][p+1]) * (cnt[1][k-p+1] - cnt[1][k-p]);
			}
		}
	}
}

int main (){
	scanf("%d %d %d",&n,&m,&k);
	for(int i = 1;i <= n;i++)
		for(int j = 1;j <= m;j++)
			scanf("%1d",&a[i][j]);
	for(int i = 1;i <= n;i++)
		for(int j = 1;j <= m;j++)
			s[i][j] = s[i-1][j] + s[i][j-1] - s[i-1][j-1] + a[i][j];
	divide(0,n,0,m,0);
	cout << ans<<endl;
	return 0;
}
